package com.copera.cn.kaka;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TabHost;

import com.copera.cn.kaka.util.ActivityManager;

/**
 * 
 * @Description:首页
 *
 * 
 *
 * 
 */
@SuppressWarnings("deprecation")
public class TableHostActivity extends TabActivity {

	private TabHost tabHost;
    private ApplicationCustomer appc;
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		ActivityManager.getInstance().push(this);
		setContentView(R.layout.tablehost);
		appc = (ApplicationCustomer) getApplication();
		tabHost=this.getTabHost();
        TabHost.TabSpec spec;
        Intent intent;

        intent=new Intent().setClass(this, ShopActivity.class);
        spec=tabHost.newTabSpec("我的店铺").setIndicator("我的店铺").setContent(intent);
        tabHost.addTab(spec);
        
        intent=new Intent().setClass(this,MipcaActivityCapture.class);
        Bundle bundle = new Bundle();
		bundle.putString("type", "track");
		intent.putExtras(bundle);
        spec=tabHost.newTabSpec("记录足迹").setIndicator("记录足迹").setContent(intent);
        tabHost.addTab(spec);
        
        intent=new Intent().setClass(this,MipcaActivityCapture.class);
        bundle = new Bundle();
		bundle.putString("type", "rule");
		intent.putExtras(bundle);
        spec=tabHost.newTabSpec("卡点兑换").setIndicator("卡点兑换").setContent(intent);
        tabHost.addTab(spec);
        
        tabHost.setCurrentTab(0);

		RadioGroup radioGroup = (RadioGroup) this
				.findViewById(R.id.main_tab_group);
		radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(RadioGroup group, int checkedId) {
				switch (checkedId) {
				case R.id.main_tab_shop:
					tabHost.setCurrentTabByTag("我的店铺");
					break;
				case R.id.main_tab_track:
					appc.setFlag(null);
					tabHost.setCurrentTabByTag("记录足迹");
					break;
				case R.id.main_tab_rule:
					appc.setFlag(null);
					tabHost.setCurrentTabByTag("卡点兑换");
					break;
				default:
					tabHost.setCurrentTabByTag("我的店铺");
					break;
				}
			}
		});
	}
	
	
	
}
